<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Flowanalysis,java.util.ArrayList,com.ejoysoft.common.Constants,com.ejoysoft.wlanyz.system.SysUserUnit,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="com.ejoysoft.common.Globa"%>
<%@ include file="../include/jsp/head.jsp"%>
<%
if(!globa.userSession.hasRight("50015"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
      
      String s=request.getParameter("fileupload");
      String l=request.getParameter("textfield");
		if(s!=null){
		//String url=s.replace("\\","/");
		String url=s.replaceAll("\\\\","\\\\\\\\");
		Flowanalysis t = new Flowanalysis(globa);
		t.method(url);
		}
%>

<% 
    //初始化
    Flowanalysis obj=new Flowanalysis(globa);
    //查询条件
    String  strCity = ParamUtil.getString(request,"strCity","").trim();
    String  strTown = ParamUtil.getString(request,"strTown","").trim();
    String  strNetType = ParamUtil.getString(request,"strNetType","").trim();
	String tWhere=" WHERE 1=1";
	if (!strCity.equals("")) {
		tWhere += " and strCity LIKE '%" + strCity + "%'";
	}
	if (!strTown.equals("")) {
		tWhere += " and strTown LIKE '%" + strTown + "%'";
	}
	if (!strNetType.equals("")) {
		tWhere += " and strNetType LIKE '%" + strNetType + "%'";
	}
	tWhere += " ORDER BY dtCreatDate";
	
	//记录总数
	int intAllCount=obj.getCount(tWhere);
	//当前页
	int intCurPage=globa.getIntCurPage();
	//每页记录数
	int intPageSize=globa.getIntPageSize();
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
	if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集
	Vector<Flowanalysis> vctObj=obj.list(tWhere,intStartNum,intPageSize);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
	ArrayList<String> cityList = obj.getAllCitiesByName();
	ArrayList<String> townList = obj.getAllTownsByName(strCity);
	ArrayList<String> typeList = obj.getAllTypeByName();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script language="javascript">
//增加信息
function add() {
   frm.action="flow_add.jsp";
   frm.submit();
}

 function showAc(){
 frm.action="flow_list.jsp";
   document.getElementById('<%=Constants.PAGE_SIZE_INDEX%>').value= "1";
  frm.submit();
 }
 function showPic(){
 frm.action="pieLook.jsp";
  frm.submit();
 }
 
 function export_sbm(page){ 
  frm.action="flow_export.jsp";
  document.getElementById("strCurPage").value = "<%=intCurPage%>";//当前页
  document.getElementById("exportContent").value = page;
  frm.submit();
 }
 function del(){
	if (iCheckedNumber(document.all.strId) == 0) {
		alert("请先选择要删除的记录！");
		return;
	}
    if(!confirm('您是否确认要删除所选中的所有记录？'))
        return;
     frm.action="flow_act.jsp?<%=Constants.ACTION_TYPE%>=<%=Constants.DELETE_STR%>";
     frm.submit();
}
function import_sbm()
 {
 window.open ('excel.jsp','newwindow','height=100,width=425,top=320,left=450,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no');
 }
</script>
<style>
A {text-decoration: NONE} 
.taba1{ width:123px; height:27px; background:url(../images/tab_1.jpg); color:#a94602; text-align:center; line-height:25px; font-weight:bolder}
</style>
</head>


<body>
<form name=frm method=post action="flow_list.jsp"> 
<table width="97%" cellspacing="0" cellpadding="0" border="0" align="center"> 
<input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
<input id="strCurPage" name="strCurPage" type="hidden" value=""/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>
  <tr> 
    <td height="30"><img height="14" width="14" align="absbottom" src="../images/ri_list.jpg" />&nbsp;您现在所在的位置：<font color="#0e7cc9">三网对比分析</font> &gt; 三网业务流量分析</td> 
  </tr> 
</table>
<table width="97%" cellspacing="0" cellpadding="0" border="0" align="center"> 
   
  <tr> 
    <td height="45" valign="middle" bgcolor="e1eef7"> 
      <table width="97%" cellspacing="0" cellpadding="0" border="0" align="center"> 
        <tr> 
          <td height="40" width="25%" align="left">地 市：(<span class="STYLE1">*</span>) 
          <select name="strCity" id="strCity" class="sel1" style="width: 100px;" onchange="showAc();"> 
          <option value="">--请选择--</option> 
			 <% for (int j = 0; j <  cityList.size(); j++) { 
					String city = cityList.get(j); 
					String selected = ""; 
					if(city !=null){ 
					if(strCity!= null && strCity.equals(city)) 
						selected = "selected='selected'"; 
				%> 
				<option value="<%=city%>" <%=selected%>> 
					<%=city%> 
				</option> 
				<% 
				} 
				} 
				%> 
          </select></td> 
          <td height="40" width="25%" align="left"> 
          县市：(<span class="STYLE1">*</span>) 
          <select name="strTown" id="strTown" class="sel1" style="width: 100px;"> 
          <option value="">--请选择--</option> 
			 <% for (int j = 0; j <  townList.size(); j++) { 
					String town = townList.get(j); 
					String selected = ""; 
					if(town !=null){ 
					if(strTown!= null && strTown.equals(town)) 
						selected = "selected='selected'"; 
				%> 
				<option value="<%=town%>" <%=selected%>> 
					<%=town%> 
				</option> 
				<% 
				} 
				} 
				%> 
          </select> 
          </td> 
          <td height="40" width="25%" align="left"> 
          网络类型：(<span class="STYLE1">*</span>) 
          <select name="strNetType" id="strNetType" class="sel1" style="width: 100px;"> 
          <option value="">--请选择--</option> 
			 <% for (int j = 0; j <  typeList.size(); j++) { 
					String type = typeList.get(j); 
					String selected = ""; 
					if(type !=null){ 
					if(strNetType!= null && strNetType.equals(type)) 
						selected = "selected='selected'"; 
				%> 
				<option value="<%=type%>" <%=selected%>> 
					<%=type%> 
				</option> 
				<% 
				} 
				} 
				%> 
          </select> 
          </td> 
          <td> 
          <img height="28" width="58" align="absmiddle" src="../images/search.jpg" onclick="showAc()" style="" /></td> 
          <td><input type="button" value = "对比分析" class="taba1"  onclick="showPic()"/></td>
          <td width="11%" align="right"><img height="27" width="64" src="../images/add.jpg" onclick="add()" style="" /></td> 
        </tr> 
      </table></td> 
  </tr> 
</table>

<table width="97%" cellspacing="0" cellpadding="0" border="0" align="center"> 
 
  <tr> 
    <td width="6%" class="listtit" style="border-left: 1px solid rgb(50, 164, 234);"><input type="checkbox" name="checkbox62" value="checkbox" onclick="selAll(document.all.strId)" style="height: 12px;" /> 
    全选</td> 
    <td width="13%" class="listtit">地市</td> 
    <td width="8%" class="listtit">区县</td> 
    <td width="10%" class="listtit">网络类型</td> 
    <td width="10%" class="listtit">网元名称</td> 
    <td width="10%" class="listtit">数据流量</td> 
    <td width="10%" class="listtit">开始时间</td> 
    <td width="10%" class="listtit">操作</td> 
  </tr> 
    <%
            
              for (int i = 0;i < vctObj.size(); i++) {
              String city = "";
              String town = "";
              String type = "";
              String netname = "";
              double flow;
              String date = "";
            	Flowanalysis obj1 = vctObj.get(i);
            	if(obj1.getStrCity()!=null)city=obj1.getStrCity();
            	if(obj1.getStrTown()!=null)town=obj1.getStrTown();
            	if(obj1.getStrNetType()!=null)type=obj1.getStrNetType();
            	if(obj1.getStrCorreType()!=null)netname=obj1.getStrCorreType();
            	flow = obj1.getStrDataFlow();
            	if(obj1.getStartTime()!=null)date = obj1.getStartTime();
            %> 
 
  <tr> 
    <td class="listd1" style="border-left: 1px solid rgb(221, 221, 221);"><input type="checkbox" name="strId" value="<%=obj1.getStrId() %>" style="height: 12px;" />&nbsp;</td> 
    <td class="listd1"> <%=city %>&nbsp;</td> 
    <td class="listd1"><%=town %>&nbsp;</td> 
    <td class="listd1"><%=type%>&nbsp;</td> 
    <td class="listd1"><a href="flow_show.jsp?strId=<%=obj1.getStrId() %>"><%=netname%>&nbsp;</a></td> 
    <td class="listd1"><%=flow%>&nbsp;</td> 
    <td class="listd1"><%=date%>&nbsp;</td> 
    <td class="listdrd" style="border-right: 1px solid rgb(221, 221, 221);"> <img height="12" width="12" align="absmiddle" src="../images/mid.jpg" /> <a href="flow_update.jsp?strId=<%=obj1.getStrId()%>">修改</a> <img height="11" width="11" align="absmiddle" src="../images/del.jpg" /> <a href="#" onclick="if(confirm('确认删除该记录？')){location.href='flow_act.jsp?<%=Constants.ACTION_TYPE%>=<%=Constants.DELETE_STR%>&amp;strId=<%=obj1.getStrId()%>';}">删除</a></td>  </tr> 
             <% 
            } 
            %> 
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  <td width="10%" height="50" valign="bottom"><img src="../images/pldel.jpg" width="83" height="27" align="middle" onclick="del();"/></td>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images/pldel.jpg" width="83" height="27" align="middle" />--> &nbsp;&nbsp;页面记录数
      <select name="strPageSize" id="strPageSize" style="width:52px;" onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		 %>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>
   		 </select>
      <img src="../images/dc.jpg" width="92" height="27" align="middle" onclick="export_sbm('currentPage')" style="cursor:hand"/> 
      <img src="../images/dcall.jpg" width="82" height="27" align="middle" onclick="export_sbm('allPage')" style="cursor:hand"/>
      <input name="B1" type="button" value="导入" onclick="import_sbm()" class="ipt2"  /></td>
    <td width="39%" align="right" valign="bottom">             
     	<%@ include file="../include/jsp/cpage.jsp"%>
       </td>
  </tr>
</table>




 </form>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>